﻿using Microsoft.VisualStudio.Shell;
using System;
using System.ComponentModel;
using System.Drawing.Design;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms.Design;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.Options
{
    [Guid("FB94271B-2D97-4B48-BEFA-D51A8D3A8AE8")]
    public class GeneralOptionPageData : DialogPage
    {
        [Browsable(true)]
        [DisplayName("FxCopCmd Path")]
        [Category("General")]
        [Description("The full path of FxCopCmd.exe.")]
        [EditorAttribute(typeof(FileNameEditor), typeof(UITypeEditor))]
        public string FxCopCmdPath { get; set; }

        [Browsable(true)]
        [DisplayName("Metrics Path")]
        [Category("General")]
        [Description("The full path of Metrics.exe.")]
        [EditorAttribute(typeof(FileNameEditor), typeof(UITypeEditor))]
        public string MetricsPath { get; set; }

        [Browsable(true)]
        [DisplayName("Use External Web Browser")]
        [Category("General")]
        [Description("Whether or not FxCop Integrator opens a web page with external web browser.")]
        public bool UseExternalWebBrowser { get; set; }

        [Browsable(true)]
        [DisplayName("\"Code Analysis\" Command Behavior")]
        [Category("General")]
        [Description("The behavior of the \"Code Analysis\" command ")]
        [TypeConverter(typeof(IntegratedCodeAnalysisCommandBehaviorsConverter))]
        public IntegratedCodeAnalysisCommandBehaviors IntegratedCodeAnalysisCommandBehavior { get; set; }


        public GeneralOptionPageData()
        {
            FxCopCmdPath = Path.Combine(Environment.GetEnvironmentVariable("ProgramFiles"), "Microsoft FxCop 10.0", "FxCopCmd.exe");
            MetricsPath = Path.Combine(Environment.GetEnvironmentVariable("ProgramFiles"), "Microsoft Visual Studio 10.0", "Team Tools", "Static Analysis Tools", "FxCop", "Metrics.exe");
            UseExternalWebBrowser = true;
            IntegratedCodeAnalysisCommandBehavior = IntegratedCodeAnalysisCommandBehaviors.All;
        }
    }
}
